{% extends "base.html" %}
{% load static %}

{% block title %}
Teacher Dashboard | {{ block.super }}
{% endblock title %}

{% block stylesheets %}
{{ block.super }}
<!-- Custom styles for this template -->
<link href="{% static "laioffer/css/dashboard.css" %}" rel="stylesheet">
{% endblock stylesheets %}

{% block content %}
{% include "_teacher_sidebar.html" %}
<section id="main-content">
    <section class="wrapper">
        <div class="table-agile-info">
            <div class="panel">

                <div class="panel-heading">{{ view.section_title }}</div>
                <div class="panel-body">

                    <div class="table-responsive">

                        <table class="table table-striped">
                            <thead>
                            <tr>
                                <th>total students</th>
                                <th>average score</th>
                                <th>exam students</th>
                            </tr>
                            </thead>

                            <tbody>
                            <tr>
                                <td>{{ sum_students }}</td>
                                <td>{{ avg_score }}</td>
                                <td>{{ sum_exam_students }}</td>
                            </tr>
                            </tbody>
                        </table>

                        {% if obj_list %}
                            <table class="table table-striped">
                                <thead>
                                <tr>
                                    <th>Username</th>
                                    <th>Score</th>
                                </tr>
                                </thead>
                                <tbody>
                                {% for obj in obj_list %}
                                    <tr>
                                        <td>
                                            <a href="{% url "course:student_detail" obj.user_id view.course_id view.course_slug %}">{{ obj.name }}</a>
                                        </td>
                                        <td>
                                            {% if obj.exam_paper_id %}
                                                <a href="{% url "exam:score" obj.exam_paper_id %}">{{ obj.score }}</a>
                                            {% else %}
                                                student not answered yet
                                            {% endif %}
                                        </td>
                                    </tr>
                                {% endfor %}
                                </tbody>
                            </table>
                        {% endif %}

                    </div>
                </div>
            </div>
        </div>
    </section>
</section>


{% endblock content %}
